
<%@page import="br.com.fatecpg.ads.poo.projeto.conexao.OracleConnector"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
    <head>
        <link rel="stylesheet" type="text/css" href="_res/css/bootstrap.css">
        <link rel="stylesheet" type="text/css" href="_res/css/bootstrap-theme.css">
        <link rel="stylesheet" type="text/css" href="_res/css/bootstrap.min.css">
        <link rel="stylesheet" type="text/javascript" href="_res/js/bootstrap.js">
        <link rel="stylesheet" type="text/css" href="estilos/estiloPagina.css">
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>JSP Page</title>
    </head>
    <body>
         
         <%@include file="../_templates/header.jsp" %>
         <%@include file="../_templates/menu.jsp" %>
         <div style="padding-left: 11em;">
             <h2>Promoções</h2>
             <table>
             <%
                if(session.getAttribute("loginUserName") != null){
                    String rows = "";
                    try{
                    String SQL = "SELECT " 
                                +" p.nm_bar, "
                                +" pro.ds_promocao "
                                +" FROM PERFIL_BAR p "
                                +" LEFT JOIN PROMOCAO pro ON (pro.ID_PERFIL_BAR = p.ID_CNPJ_BAR) ";
                    for(Object[] reg:  OracleConnector.getQuery(SQL)){ 
                                     rows +=" <tr>";
                                     for(int i = 0; i< reg.length;i++){
                                        rows +=" <td>"+ reg[i] + " </td>";
                                     }
                                     rows +=" </tr>";
                            }
                    }catch(Exception ex){
                        rows= " <span style='color:red;'>"+ ex.getLocalizedMessage()+ " </span>";
                    }
                    out.println(rows);
                }
             
             %>
             </table>
         </div>
             
             <%
             for(int cont = 0; cont <= 13; cont ++){
                 out.println("<br>");
             }
             %>
                        
             <center>
             <%--<img src="_res/images/ambiante2.jpg">--%>
             <%@include file="../_templates/footer.jsp"%>    
             </center>
    </body>
</html>
